package com.juku2024.juku.db.dao;


import androidx.room.Dao;
import androidx.room.Delete;
import androidx.room.Insert;
import androidx.room.OnConflictStrategy;
import androidx.room.Query;

import com.juku2024.juku.db.entity.VideoVersionEntity;

import java.util.List;

@Dao
public interface VideoVersionDao {

    @Query("SELECT version FROM VideoVersion WHERE videoId=:videoId")
    String queryVersion(long videoId);

    @Query("SELECT * FROM VideoVersion WHERE videoId=:videoId")
    VideoVersionEntity query(long videoId);

    @Query("SELECT videoId FROM VideoVersion")
    List<Long> queryAll();

    @Insert(onConflict = OnConflictStrategy.REPLACE)
    void insert(VideoVersionEntity entity);

    @Delete
    void delete(VideoVersionEntity entity);

    @Query("DELETE FROM VideoVersion WHERE videoId=:videoId")
    void delete(long videoId);

    @Query("DELETE FROM VideoVersion")
    void deleteAll();
}
